package com.cy.detectsys.controller.sys;

import com.cy.detectsys.util.R;
import com.cy.detectsys.util.TaskIdGenerator;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("id")
public class IdGenerateController {

    @Resource
    private TaskIdGenerator taskIdGenerator;


    /**
     * 根据传来的前缀生成 编号
     * @param prefix
     * @return  RW2024050900069
     */
    @RequestMapping("generate")
    public R generate(@RequestParam String prefix) {
        return taskIdGenerator.generateTaskIdwithPrefix(prefix);

    }
}
